/**
 * Copyright &copy; 2013-2016 山东易科德软件有限公司 All rights reserved.
 */
package cn.net.ecode.modules.cms.web.front;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.net.ecode.common.utils.StringUtils;
import cn.net.ecode.common.web.BaseController;
import cn.net.ecode.modules.cms.entity.VisitLog;
import cn.net.ecode.modules.cms.service.VisitLogService;
import cn.net.ecode.modules.cms.utils.VisitLogCollect;

/**
 * 访问日志Controller
 * @author ThinkGem
 * @version 2015-12-28
 */
@Controller
@RequestMapping(value = "${frontPath}/visitLog")
public class FrontVisitLogController extends BaseController{

	@Autowired
	private VisitLogService visitLogService;
	
	/**
	 * 访问日志记录
	 */
	@ResponseBody
	@RequestMapping(value = "record")
	public String record(VisitLog visitLog, HttpServletRequest request, HttpServletResponse response) {
		
		VisitLogCollect vlc = new VisitLogCollect(request, response);
		visitLogService.save(vlc.outputVisitLog(visitLog));
		
		return StringUtils.EMPTY;
	}
	
}
